home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 112_01.zip / DISKDOC.DOC < prev    next >
Text File  |  1993-06-19  |  6KB  |  161 lines

  1. VER 008    MARG+1,66
  2.  
  3.  
  4. Small-C DISKDOC:
  5. A REPAIR AND MAINTENANCE UTILITY
  6.  
  7. By Egil Kvaleberg, N-4060 Kleppe, Norway.
  8.  
  9. Appeared in the Dr. Dobb's Journal #66, April 1982.
  10.  
  11.  
  12.  
  13.        Diskdoc is a utility that, like its name implies, is
  14. intended for repair and maintainance of diskettes and other
  15. random access mass storage media. Tasks accomplished include:
  16.  i     Taking backups (also in a single drive system).
  17.  ii    Verifying data integrity.
  18.  iii   Restoring previously deleted files (by manual patching).
  19.  iv    Repairing faulty sectors.
  20.  v     Debugging disk driver routines and controller hardware.
  21.  vi    Debugging file systems.
  22.  
  23.        Diskdoc has been in frequent use for about two years now
  24. (including a one year assembly language childhood), and has
  25. proved a useful companion when exploring the oh-so-vulnerable
  26. world of diskettes. 
  27.        The version listed runs under CP/M, but adapting
  28. to other operating systems will probably not be found too
  29. difficult a task to accomplish. As explained in the listing, te
  30. program is written to be compiled by the Ron Cain Small-C
  31. compiler. Small-C is smaller than standard C, and conoisseurs of
  32. the C language will find some of the constructions used quite
  33. primitive. If you prepare the program for a richer dialect of C,
  34. you might consider rewriting parts of the program. Except for
  35. efficiency, perhaps, there is little reason to take the bother
  36. since Small-C is a true subset of C.
  37.  
  38.  
  39.  
  40. TALKING TO DISKDOC
  41.  
  42.        Diskdoc always tries to give self explanatory prompts. The
  43. default value can usually be displayed by typing <cr> once. If
  44. you should enter an inappropriate character, diskdoc simply
  45. refuses to echo it. Entries may be corrected by using the
  46. backspace key. A final <cr> will, as usual, end the input line.
  47.  
  48.  
  49.  
  50. THE COMMAND LEVEL
  51.  
  52.        Starting up, diskdoc will enter the command level,
  53. requesting a single letter command:
  54.  
  55.  a     Adapt to terminal type. You will asked to enter the
  56.        character that will move the cursor home. An escape
  57.        sequence is acceptable. This is all that is required to
  58.        adapt diskdoc to virtually any video terminal. It is
  59.        assumed that the width of the screen is 80 characters.
  60.  
  61.  b     Backup entire diskette, on a sector-by-sector basis. You
  62.        will be asked to enter the source and destination drive
  63.        names (a-h). It is crucial to double-check the direction
  64.        of data flow. The same drive might be assigned as both
  65.        source and destination, in which case diskdoc will request
  66.        a diskette change whenever necessary during the copy
  67.        process. If an error is detected in the source diskette,
  68.        diskdoc will ask whether the sector read operation should
  69.        be retried, the error ignored, or the backup aborted. It
  70.        is recommended to retry a few times before declaring a
  71.        sector unrecoverable, thereby filtering out intermittently
  72.        occuring errors. If desired, backup can be aborted by
  73.        typing any character.
  74.  
  75.  c     Compare the contents of two diskettes. Every discrepancy
  76.        will be reported. Abort by typing any character.
  77.  
  78.  e     Exit. You will be prompted to insert a system diskette
  79.        before leaving.
  80.  
  81.  p     Patch. Look at and optionally patch selected sectors. For
  82.        patch subcommands, see below.
  83.  
  84.  s     Scan diskette by reading every sector. The test will
  85.        quickly locate any sector that doesn't give a proper CRC.
  86.        The test might be interrupted by typing any character.
  87.  
  88.  t     Test diskette. A test pattern will be written, and the
  89.        entire diskette will then be read back and compared. The
  90.        write operation may be omitted. The command provides
  91.        useful verification of disk controller hardware and
  92.        software operation.
  93.  
  94.  z     Zero diskette. The specified number of tracks will be
  95.        erased by filling the EBCDIC character 'V' (0E5H).
  96.  
  97.  
  98.  
  99. PATCH COMMANDS
  100.      
  101.  <sp>  Move the cursor to the next byte.
  102.  
  103.  <bs>  Move the cursor to the previous byte.
  104.  
  105.  <cr>  Move the cursor down, i.e. 16 bytes forward.
  106.  
  107.  <hex> To patch, enter the new hex byte directly. After having
  108.        entered the first digit, a <bs> will "undo" it. After
  109.        having entered the second, the cursor will move to the
  110.        next byte.
  111.  
  112.  '     To enter an ascii character, type a single quote followed
  113.        by the desired character.
  114.  
  115.  l     Read the logically following sector. This command is
  116.        useful where a mapping between physical and logical
  117.        sectors exists, such as in standard CP/M single density
  118.        diskettes.
  119.  
  120.  n     Read the next sequential sector. The next track is
  121.        accessed if the end of the current one is reached.
  122.  
  123.  q     Quit patch mode.
  124.  
  125.  r     Re-read. Read the current sector once again.
  126.  
  127.  s     Shift the rest of the sector one bit-position to the
  128.        right. This command is useful when attempting to repair
  129.        sectors where the controller has lost a few bits here and
  130.        there.
  131.  
  132.  t     Select a new track and/or sector.
  133.  
  134.  w     Write back the current sector. Remember to use this
  135.        command after having made any changes, since no automatic
  136.        write is performed.
  137.  
  138.  
  139.  
  140. REGARDING THE CP/M VERSION
  141.  
  142.        The CP/M version, as listed, will adapt to the physical
  143. characteristics of the drive (track and sector counts). This is
  144. accomplished by reading the disk parameter block returned by the
  145. BIOS drive select call. CP/M version 2.0 or better is required.
  146. For drives using sector blocking/deblocking schemes, the sectors
  147. that diskdoc works with will not correspond directly to the
  148. physical sectors.
  149.  
  150.  
  151.  
  152. ADAPTING TO OTHER OPERATING SYSTEMS AND/OR COMPILERS
  153.  
  154.        All implementation depandant functions are containded in
  155. the file "ddocsys.c". These functions are all very low-level, and
  156. thus very non-standard. You will have to write these functions
  157. yourself, since no C runtime libraries will support them. If
  158. automatic size adaptation and/or logical to physical sector
  159. mapping aren't required, the functions seldrv() and lnext(),
  160. respectively, can be considerably simplifed.
  161.